package com.linkage.yninterface.process.processClass;


import com.linkage.yninterface.util.sysConst;
import com.linkage.yninterface.process.*;

import java.util.*;
import com.linkage.yninterface.util.sysUtil;
import com.linkage.yninterface.db.DB;

/**
 * <p>Title: yun nan CRM interface</p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2010</p>
 *
 * <p>Company: linkage</p>
 *
 * @author weib
 * @version 1.0
 */
public class processvcustomer extends process {

    private DB db = new DB(sysConst.mainDBJNDI);

    public processResult checkServiceName(processPara pp) throws Exception {
        HashMap hm = pp.getParseFields();

        String username = ((processMapInfo) hm.get(".username")).getValue();
        String realm = ((processMapInfo) hm.get(".realm")).getValue();

        String hash = sysUtil.getHash(username);
        String sql = "select * from e_customer where customername = '"
                         + username + "' and realm='" + realm + "'";
            if (db.isExist(sql))
                return new processResult(sysConst.resultCode5,
                                         sysConst.reaultDes5);
            else
                return new processResult(sysConst.resultCode6,
                                         sysConst.reaultDes6);

        }
    }


